<?php
/**
 * Created by PhpStorm.
 * User: liuda
 * Date: 2019/2/22
 * Time: 15:16
 */

namespace app\h5\controller;


use app\common\model\User;
use think\Controller;
use think\facade\Session;

class Base extends Controller
{
    protected $loginUser;

    public function checkLogin(){
        $userId = Session::get('uid');
        if(empty($userId)){
            $this->redirect('/h5/login');
            return true;
        }
        $model = new User();
        $user = $model->get($userId);
        if(!$user){
            $this->redirect('/h5/login');
            return true;
        }
        $this->loginUser = $user->toArray();
        return true;
    }
}